package com.boo.service;

import org.json.JSONObject;

import android.util.Log;

import com.loopj.android.http.JsonHttpResponseHandler;
import com.thuanhoang.boo.MapActivity;

/**
 * Get user service - authentication service
 * 
 * @author ThuanHM <thuanhm@vnext.vn>
 * @since 2013/12/27
 * */
public class StoreService extends BaseService {
	private MapActivity map;

	public StoreService(MapActivity parentActivity) {
		super(parentActivity);
		this.map = parentActivity;
	}


	public void getData(final String url){
		this.get(parentActivity,url, new JsonHttpResponseHandler() {
			@Override
			public void onSuccess(JSONObject response) {
				Log.d("store", "ok " + response);
				map.afterStore(response);
				setCache(url, response.toString());
			}

			@Override
			public void onFailure(Throwable error) {
				Log.d("error", "is " + error.getMessage());
				error.printStackTrace();
			}
		});
	}
}